Fix git:branch bug when there is more than one branch with equal SHA-ID#7
Open
mrjaros wants to merge 6 commits intogleber:masterfrom
Open
Fix git:branch bug when there is more than one branch with equal SHA-ID#7mrjaros wants to merge 6 commits intogleber:masterfrom
mrjaros wants to merge 6 commits intogleber:masterfrom
Conversation
src/git.erl
Outdated
added 2 commits
July 9, 2014 12:46
use generic string:join instead of specific list_join.
Author
|
hmm, how about just branch(Repo) ->
case status_is_detached(Repo) of
false ->
{ok, B} = sh("git rev-parse --abbrev-ref HEAD", [{cd, Repo}]),
B--"\n";
true ->
detached
end. |
of all branches for current sha.
-spec branch(dir()) -> {'ok', branch()} | 'detached'.
branch(Repo) ->
case status_is_detached(Repo) of
false ->
CurrentBranch = strip(oksh("git symbolic-ref --short HEAD", [{cd, Repo}])),
{ok, CurrentBranch};
true ->
detached
end.And if you don't want to use see other options: http://stackoverflow.com/a/19585361 |
Author
|
Good idea to use oksh with strip. I've missed it. |
src/git.erl
Outdated
Owner
There was a problem hiding this comment.
This is incorrect. -include_lib automatically finds an application "erlsemver" (even if it located in a folder name with version number) and will find include/semver.hrl from there.
In general -include_lib is preferred over -include.
If you really need to use brute force relative path, use -include.
Author
There was a problem hiding this comment.
True, my bad, homie. I used this to make c(module) possible, committed and pushed accidentally. Trash it.
Owner
There was a problem hiding this comment.
Can't trash it on my side. Delete it from PR, so I can merge it :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes badmatch error when we have more than one branch with equal sha-id. In such case, you tried to match one-element list ([B]) with list of branches (["branchA", "branchB"]). Now we just return list of branches, separated with "; ", ex. "branchA; branchB"